package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.util.Utils;

public class CONCATENATE extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; i < paramArrayOfObject.length; ++i)
      localStringBuffer.append(Utils.objectToString(paramArrayOfObject[i]));
    return localStringBuffer.toString();
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "CONCATENATE(text1,text2,...): 将数个字符串合并成一个字符串。\nText1,text2,...:需要合并成单个文本的文本项，可以是字符，数字或是单元格引用。\n备注:\n    也可以用“&”来代替CONCATENATE函数对文本项进行合并。\n示例:\nCONCATENATE(\"Average \",\"Price\")等于“Average Price”。这相当于“Average”&“ ”&“Price”。\nCONCATENATE(\"1\",\"2\")等于12。";
  }

  public String getEN()
  {
    return "CONCATENATE(text1,text2,...): Joins several text strings into one text string.\nText1, text2, ... are 1 to 30 text items to be joined into a single text item. The text items can be text strings, numbers, or single-cell references.\n\nRemarks:\n   The \"&\" operator can be used instead of CONCATENATE to join text items.\n\nExample:\n   CONCATENATE(\"Average \",\"Price\") = \"Average Price\", it equals \"Average\"&\" \"&\"Price\".\n   CONCATENATE(\"1\",\"2\") = 12";
  }
}